﻿using System;

namespace isvn.Helper
{
    public static class Output
    {
        private static void WriteColoredText(string text, ConsoleColor fcolor, ConsoleColor bcolor)
        {
            if (string.IsNullOrEmpty(text))
                return;

            ConsoleColor ofcolor = Console.ForegroundColor;
            ConsoleColor obcolor = Console.BackgroundColor;

            Console.ForegroundColor = fcolor;
            Console.BackgroundColor = bcolor;
            Console.Write(text);

            Console.ForegroundColor = ofcolor;
            Console.BackgroundColor = obcolor;
        }

        private static void WriteColoredText(string text, ConsoleColor fcolor)
        {
            WriteColoredText(text, fcolor, Console.BackgroundColor);
        }

        public static void WriteHelp(string helpText)
        {
            WriteColoredText(helpText, ConsoleColor.Cyan);
        }

        public static void WriteSuccess(string text)
        {
            WriteColoredText(text, ConsoleColor.Green);
        }

        public static void WriteError(string errorText)
        {
            WriteColoredText(errorText, ConsoleColor.Red);
        }

        public static void WriteQuestion(string question)
        {
            WriteColoredText(question, ConsoleColor.Yellow);
        }

        public static void Write(string text)
        {
            WriteColoredText(text, ConsoleColor.Gray);
        }
    }
}
